package org.colafries.common.utils;

import org.hashids.Hashids;

/**
 * @author colafries
 * @version v1.0
 * @ClassName HashUtil
 * @Description
 * @date Created in 2024/4/8
 **/
public class HashUtil {
    public static String getHash(String SALT){
        int MIN_HASH_LENGTH = 11;
        Hashids hashids = new Hashids(SALT, MIN_HASH_LENGTH);
        String encryptString = hashids.encode(347L);
        return encryptString.toUpperCase(); // Y5bAyr8dLO4
    }

    public static String genFieldHash(String field) {
        return "COL" + getHash(field);
    }

    public static String genCustomTableHash(String customSql) {
        return "SQLV_" + HashUtil.getHash(customSql);
    }
}
